package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Zproductside {
    private Integer psId;
    private BigDecimal psPrice;
    private Timestamp psDate;
    private Integer psNumber;
    private Integer psState;
    private BigDecimal psFactoryPrice;
    private String psUnit;
  /*  private Collection<Zproduct> zproductsByPsId;*/
    private Collection<Zproductimgs> zproductimgsByPsId;
    private Zproduct zproductByProductId;
    private Collection<Zsidesmodelmiddle> zsidesmodelmiddlesByPsId;


    @Id
    @Column(name = "ps_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public Integer getPsId() {
        return psId;
    }

    public void setPsId(Integer psId) {
        this.psId = psId;
    }

    @Basic
    @Column(name = "ps_price")
    public BigDecimal getPsPrice() {
        return psPrice;
    }

    public void setPsPrice(BigDecimal psPrice) {
        this.psPrice = psPrice;
    }

    @Basic
    @Column(name = "ps_date")
    public Timestamp getPsDate() {
        return psDate;
    }

    public void setPsDate(Timestamp psDate) {
        this.psDate = psDate;
    }

    @Basic
    @Column(name = "ps_number")
    public Integer getPsNumber() {
        return psNumber;
    }

    public void setPsNumber(Integer psNumber) {
        this.psNumber = psNumber;
    }

    @Basic
    @Column(name = "ps_state")
    public Integer getPsState() {
        return psState;
    }

    public void setPsState(Integer psState) {
        this.psState = psState;
    }

    @Basic
    @Column(name = "ps_factory_price")
    public BigDecimal getPsFactoryPrice() {
        return psFactoryPrice;
    }

    public void setPsFactoryPrice(BigDecimal psFactoryPrice) {
        this.psFactoryPrice = psFactoryPrice;
    }


    @Basic
    @Column(name = "ps_unit")
    public String getPsUnit() {
        return psUnit;
    }

    public void setPsUnit(String psUnit) {
        this.psUnit = psUnit;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Zproductside that = (Zproductside) o;
        return psId == that.psId &&
                Objects.equals(psPrice, that.psPrice) &&
                Objects.equals(psDate, that.psDate) &&
                Objects.equals(psNumber, that.psNumber) &&
                Objects.equals(psState, that.psState);
    }

    @Override
    public int hashCode() {
        return Objects.hash(psId, psPrice, psDate, psNumber, psState);
    }

   /* @OneToMany(mappedBy = "zproductsideByPsId")
    public Collection<Zproduct> getZproductsByPsId() {
        return zproductsByPsId;
    }

    public void setZproductsByPsId(Collection<Zproduct> zproductsByPsId) {
        this.zproductsByPsId = zproductsByPsId;
    }*/

    @OneToMany(mappedBy = "zproductsideByPsId")
    public Collection<Zproductimgs> getZproductimgsByPsId() {
        return zproductimgsByPsId;
    }

    public void setZproductimgsByPsId(Collection<Zproductimgs> zproductimgsByPsId) {
        this.zproductimgsByPsId = zproductimgsByPsId;
    }

    @ManyToOne
    @JoinColumn(name = "product_id", referencedColumnName = "product_id")
    public Zproduct getZproductByProductId() {
        return zproductByProductId;
    }

    public void setZproductByProductId(Zproduct zproductByProductId) {
        this.zproductByProductId = zproductByProductId;
    }

    @OneToMany(mappedBy = "zproductsideByPsId")
    public Collection<Zsidesmodelmiddle> getZsidesmodelmiddlesByPsId() {
        return zsidesmodelmiddlesByPsId;
    }

    public void setZsidesmodelmiddlesByPsId(Collection<Zsidesmodelmiddle> zsidesmodelmiddlesByPsId) {
        this.zsidesmodelmiddlesByPsId = zsidesmodelmiddlesByPsId;
    }

}
